//重点指标实时监控
/* eslint-disable */
import React, { Component } from 'react';
import { connect } from 'dva';
import { Tabs, Radio } from 'antd';
import styles from './RealTime.less';
import MyTable from '../../../components/common/MyTable';
import update from 'immutability-helper';
import MyModal from '../../../components/common/MyModal';
import Echarts_Day from '../echarts/Echarts_Day';
import request from '../../../utils//request';
const { TabPane } = Tabs;
class RealTime extends Component {
    constructor(props) {
        super(props);
        this.state = {
            MyModal1Visible: false,
            tableLoading: false,
            dataSate: [
            ],
            params: {},
            pageSize: 10,
            pageIndex: 1,
            total: 0,
            addModal: false,
            columns: [
                {
                    dataIndex: 'num',
                    title: '指标名称',
                    key: 'num',
                    width: 150,
                },
                {
                    dataIndex: 'num',
                    title: '指标单位',
                    key: 'num',
                    width: 150,
                },
                {
                    dataIndex: 'num',
                    title: '#1锅炉',
                    key: 'num',
                    width: 150,
                },
                {
                    dataIndex: 'num',
                    title: '#2锅炉',
                    key: 'num',
                    width: 150,
                },
                {
                    dataIndex: 'num',
                    title: '#3锅炉',
                    key: 'num',
                    width: 150,
                },
                {
                    dataIndex: 'num',
                    title: '#4锅炉',
                    key: 'num',
                    width: 150,
                },
               
            ],

        }



    }
    componentDidMount() {
        this.getGuoluZbRunTimeData()
    };

    getGuoluZbRunTimeData = () => {
        request({
            url: `/sx-client/sx/keyindicator/getGuoluZbRunTimeData?equipmentId=402880e5703d658801703d68a70e0000&userId=admin`,
            method: 'GET',
        }).then(data => {
            console.log(data)
            this.setState({

            })

        })
    }

    onChange = () => {

    }

    onSave = (text, record, index) => {
        console.log(text, record, index)
        this.setState({
            MyModal1Visible:true
        })
    }

        // 取消保存
        ModalCancel = (type) => {
            let t = this;
            t.setState({
                [type]: false,
                modalBtnLoading: false
            })
        };


    render() {
        let width = document.body.clientWidth;
        const height = document.body.clientHeight;
        let containerHeight = '69vh';
        let tableHeight = 230;
        if (width > 1366) {
            tableHeight = 270;
            containerHeight = '69vh';
        }
        const { addModal, footerShow, modalBtnLoading, modalTitle, dataSate, tableLoading, pageSize, pageIndex, total, columns } = this.state
        return (

            <div className={styles.warp}>
                {
                    this.state.MyModal1Visible &&
                    <MyModal
                        width={1200}
                        visible={this.state.MyModal1Visible}
                        title={'趋势图'}
                        footerShow={false}
                        destroyOnClose={true}
                        onCancel={this.ModalCancel.bind(this, 'MyModal1Visible')}

                    >
                        <Echarts_Day
                            // data={this.state.Protu}
                        />
                    </MyModal>

                }
                <Tabs defaultActiveKey="1" className={styles.Tabs}>
                    <TabPane tab="清能环保" key="1">
                        <Radio.Group onChange={this.onChange} defaultValue="a" style={{ paddingBottom: 16 }}>
                            <Radio.Button value="a" style={{ marginRight: 20 }}>锅炉指标</Radio.Button>
                            <Radio.Button value="b" style={{ marginRight: 20 }}>汽机指标</Radio.Button>
                            <Radio.Button value="c">环保指标</Radio.Button>
                        </Radio.Group>
                        <div style={{ height: containerHeight, overflow: 'auto', position: 'relative' }}>
                            <MyTable
                                // loading={tableLoading}
                                columns={columns}
                                // scroll={{ y: height - tableHeight, x: 2000 }}
                                dataSource={dataSate}
                                pagination={false}
                            />
                        </div>

                    </TabPane>
                    <TabPane tab="再生能源" key="2">
                        Content of Tab Pane 2
                    </TabPane>
                    <TabPane tab="维尔利" key="3">
                        Content of Tab Pane 3
                    </TabPane>
                    <TabPane tab="清运公司" key="4">
                        Content of Tab Pane 3
                    </TabPane>
                </Tabs>
            </div>
        )
    }


}

export default connect()(RealTime)